
extends public/layout

block content
    div(ng-controller='searcher').container
        div.search-catalog
            ol.breadcrumb
                li
                    span 全部
                if(qr)
                    li
                        span #{qr}
                if(selector.selected)
                    if(selector.selected.category)
                        mixin parent(category)
                            if(category.parent)
                                +parent(category.parent)
                            if(category.brothers)
                                li
                                    div.btn-group
                                        button.btn.btn-default.btn-xs.dropdown-toggle(type='button' data-toggle='dropdown') #{category.name}
                                            span.caret
                                        ul(role='menu').dropdown-menu
                                            each item in category.brothers
                                                li
                                                    a(href='/search?cid=#{item.id}') #{item.name}
                            else
                                li
                                    span #{category.name}
                        +parent(selector.selected.category)
                    each value, key in selector.selected.attributes
                        li
                            span.selected #{key}:#{selector.selected.attributes[key]}
                                a(href='/search/attribute/filter?#{merge4params(query, selector.selected.reject(key))}').crumb-delete

            table.table
                caption
                    label.highlight-font #{qr}
                    label 商品刷选
                    span.mini-font (共
                    span.highlight-font.mini-font #{count}
                    span.mini-font 个商品)
                - var index = 0
                mixin selector-line(key, value)
                    th #{key}：
                    if(key=='品牌')
                        td(ng-init='menu=false').brand
                            ul(ng-show='menu').horizontal-menu
                                li(ng-mouseover='brand4hover($event)' data-value='0' class='active') 所有品牌
                                li(ng-mouseover='brand4hover($event)' data-value='A') A
                                li(ng-mouseover='brand4hover($event)' data-value='B') B
                                li(ng-mouseover='brand4hover($event)' data-value='C') C
                                li(ng-mouseover='brand4hover($event)' data-value='D') D
                                li(ng-mouseover='brand4hover($event)' data-value='E') E
                                li(ng-mouseover='brand4hover($event)' data-value='F') F
                                li(ng-mouseover='brand4hover($event)' data-value='G') G
                                li(ng-mouseover='brand4hover($event)' data-value='H') H
                                li(ng-mouseover='brand4hover($event)' data-value='I') I
                                li(ng-mouseover='brand4hover($event)' data-value='J') J
                                li(ng-mouseover='brand4hover($event)' data-value='K') K
                                li(ng-mouseover='brand4hover($event)' data-value='L') L
                                li(ng-mouseover='brand4hover($event)' data-value='M') M
                                li(ng-mouseover='brand4hover($event)' data-value='N') N
                                li(ng-mouseover='brand4hover($event)' data-value='O') O
                                li(ng-mouseover='brand4hover($event)' data-value='P') P
                                li(ng-mouseover='brand4hover($event)' data-value='Q') Q
                                li(ng-mouseover='brand4hover($event)' data-value='R') R
                                li(ng-mouseover='brand4hover($event)' data-value='S') S
                                li(ng-mouseover='brand4hover($event)' data-value='T') T
                                li(ng-mouseover='brand4hover($event)' data-value='U') U
                                li(ng-mouseover='brand4hover($event)' data-value='V') V
                                li(ng-mouseover='brand4hover($event)' data-value='W') W
                                li(ng-mouseover='brand4hover($event)' data-value='X') X
                                li(ng-mouseover='brand4hover($event)' data-value='Y') Y
                                li(ng-mouseover='brand4hover($event)' data-value='Z') Z
                                li(ng-mouseover='brand4hover($event)' data-value='其它') 其它
                            div.brand-wrap
                                each v in value
                                    a(href='/search/attribute/filter?#{merge4params(query, selector.selected.append(key, v.value))}' data-xchar='#{v.xchar}' style='width:150px').selector-unit #{v.value}
                    else
                        td
                            each v, index in value
                                a(href='/search/attribute/filter?#{merge4params(query, selector.selected.append(key, v))}').selector-unit #{v}
                    //td
                    //td
                    if(key == '品牌' && value.length>20)
                        td.operation
                            a.common(ng-click='more($event)') 更多
                                i.crumb-drop
                    else
                        td.operation
                    //td.operation
                        a.common(href='javascript:void;') <strong>+</strong>  多选
                - var extraArray = []
                if(selector.attributes)
                    each value, key in selector.attributes
                        if(!selector.selected || !selector.selected.attributes || !selector.selected.attributes[key])
                            if(index>4)
                                - extraArray.push(key)
                                tr(ng-show='drawable')
                                    + selector-line(key, value)
                            else
                                tr
                                    + selector-line(key, value)
                        - ++index
            if extraArray.length > 0
                - var extraStr = (extraArray.length>3?extraArray.slice(0,3):extraArray).join('、')
                div.text-center
                    div.footer-more(ng-click='drawable=!drawable' ng-init='drawable=false') {{drawable?"收起":"更多选项（#{extraStr}等）"}}
                        i(ng-class='drawable?"crumb-up":"crumb-drop"')
        // btn-panel
        div.btn-panel
            div.btn-group.btn-group-xs
                a.btn.btn-default(type='button' href='/search/attribute/filter?#{merge4params(query, selector.selected.origin(), {"selected.price.start":selector.selected.price&&selector.selected.price.start}, {"selected.price.end":selector.selected.price&&selector.selected.price.end})}' class='#{!selector.selected.sort?"btn-danger":""}') 综合
                    i.crumb-drop
                a.btn.btn-default(type='button' href='/search/attribute/filter?#{merge4params(query, selector.selected.origin(), {"selected.sort":"new"}, {"selected.price.start":selector.selected.price&&selector.selected.price.start}, {"selected.price.end":selector.selected.price&&selector.selected.price.end})}' class='#{selector.selected.sort=="new"?"btn-danger":""}') 新品
                    i.crumb-drop
                a.btn.btn-default(type='button' href='/search/attribute/filter?#{merge4params(query, selector.selected.origin(), {"selected.sort":"popular"}, {"selected.price.start":selector.selected.price&&selector.selected.price.start}, {"selected.price.end":selector.selected.price&&selector.selected.price.end})}' class='#{selector.selected.sort=="popular"?"btn-danger":""}') 人气
                    i.crumb-drop
                a.btn.btn-default(type='button' href='#') 销量
                    i.crumb-drop
            div.btn-group.btn-group-xs(ng-init='focusInput=false;overPanel=false')
                input.btn.btn-input(type='text' placeholder='￥' ng-focus='focusInput=true' ng-blur='focusInput=false' ng-model='price4start' ng-init='#{selector.selected.price&&selector.selected.price.start&&"price4start="+selector.selected.price.start||""}')
                i.btn -
                input.btn.btn-input(type='text' placeholder='￥' ng-focus='focusInput=true' ng-blur='focusInput=false'  ng-model='price4end' ng-init='#{selector.selected.price&&selector.selected.price.end&&"price4end="+selector.selected.price.end||""}')
                div.price-choose-panel(ng-show='focusInput || overPanel' ng-mouseover='overPanel=true' ng-mouseleave='overPanel=false')
                    button.btn.btn-xs.btn-default(ng-click='focusInput=false') 取消
                    a(href='/search/attribute/filter?#{merge4params(query, selector.selected.origin(), {"selected.sort":selector.selected.sort})}&selected.price.start={{price4start}}&selected.price.end={{price4end}}').btn.btn-xs.btn-danger 确定
        //good-panel
        div.good-panel
            if page.data && page.data.length>0
                mixin wrap(goods)
                    div.item-wrap
                        a(href='/goods/details/#{goods.id}' alt='' target='_blank')
                            img(src='#{goods.images.split(",")[0]}')
                        h4.highlight-font ￥#{goods.price}
                        p.title
                            a(target='_blank', title='#{goods.title}')!=goods.highlightTitle || goods.title
                        p
                            a.common.shopkeeper #{goods.store}
                        p
                            each keyword in goods.keywords.length>4?goods.keywords.splice(0,4):goods.keywords
                                span.keyword!=keyword
                        div
                            span.deal 月成交&nbsp;
                                strong 655笔&nbsp;
                            span.comment &nbsp;评价&nbsp;
                                strong #{goods.comment}
                            span.img &nbsp;
                each goods, i in page.data
                    if (i+1)%5==0
                        div.good-item(style='margin-right:0;')
                            +wrap(goods)
                    else
                        div.good-item
                            +wrap(goods)
            else
                div.text-center 没有任何商品哦
        //pagination
        div.text-center
            ul.pagination
                if(page.pageNum>1)
                    li
                        a(href='/search/attribute/filter?#{merge4params(query, selector.selected.origin(), {"selected.sort":selector.selected.sort}, {pageNum:+page.pageNum-1}, {"selected.price.start":selector.selected.price&&selector.selected.price.start}, {"selected.price.end":selector.selected.price&&selector.selected.price.end})}') 上一页
                if(page.begin>2)
                    li
                        a(href='/search/attribute/filter?#{merge4params(query, selector.selected.origin(), {"selected.sort":selector.selected.sort}, {pageNum:1}, {"selected.price.start":selector.selected.price&&selector.selected.price.start}, {"selected.price.end":selector.selected.price&&selector.selected.price.end})}') 1
                    li
                        a(href='#') ...
                - for(var i = page.begin; i<=page.end; i++){
                    if(page.pageNum==i)
                        li.active
                            a(href='/search/attribute/filter?#{merge4params(query, selector.selected.origin(), {"selected.sort":selector.selected.sort}, {pageNum:i}, {"selected.price.start":selector.selected.price&&selector.selected.price.start}, {"selected.price.end":selector.selected.price&&selector.selected.price.end})}') #{i}
                    else
                        li
                            a(href='/search/attribute/filter?#{merge4params(query, selector.selected.origin(), {"selected.sort":selector.selected.sort}, {pageNum:i}, {"selected.price.start":selector.selected.price&&selector.selected.price.start}, {"selected.price.end":selector.selected.price&&selector.selected.price.end})}') #{i}
                - }
                if(page.end<page.pageCount-1)
                    li
                        a(href='#') ...
                    li
                        a(href='/search/attribute/filter?#{merge4params(query, selector.selected.origin(), {"selected.sort":selector.selected.sort}, {pageNum:page.pageCount}, {"selected.price.start":selector.selected.price&&selector.selected.price.start}, {"selected.price.end":selector.selected.price&&selector.selected.price.end})}') #{page.pageCount}
                if(page.pageNum<page.end)
                    li
                        a(href='/search/attribute/filter?#{merge4params(query, selector.selected.origin(), {"selected.sort":selector.selected.sort}, {pageNum:+page.pageNum+1}, {"selected.price.start":selector.selected.price&&selector.selected.price.start}, {"selected.price.end":selector.selected.price&&selector.selected.price.end})}') 下一页

